package pl.dalkia.services.scanner.services.inputanalizer;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class InputAnalizer {

	private static final Logger log = LoggerFactory.getLogger(InputAnalizer.class);

	public void analizeInput(String[] args) {
		if (args.length != 3) {
			log.error(String.format(
					"Wrong amount of arguments passed to application: %1$d.",
					args.length));
			log.info("There should be 3 arguments i.e.: dir/config.txt dir/log.txt dir/output.txt");
			System.exit(1);
		} else {
			StringBuilder stringBuilder = prepareLog(args);
			log.info(String.format("Application has received: %1$s arguments\n", stringBuilder));
		}
	}

	private StringBuilder prepareLog(String[] args) {
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.append("\n- ");
		stringBuilder.append(args[0]);
		stringBuilder.append("\n- ");
		stringBuilder.append(args[1]);
		stringBuilder.append("\n- ");
		stringBuilder.append(args[2]);
		stringBuilder.toString();
		return stringBuilder;
	}
	
}
